package com.elvin.zoe.pojo;

import java.text.ParseException;
import java.util.Date;

public class CallMessage extends Message {

    private int durationInSeconds;
    private Date endDatetime;

    public CallMessage() {
        super();
    }

    public CallMessage(int type, String datetimeString, String datetimeFormat, int durationInSeconds) throws ParseException {
        super();
        this.type = type;
        this.durationInSeconds = durationInSeconds;
        this.datetimeFormat = datetimeFormat;
        setDatetimeString(datetimeString);
    }

    @Override
    public void setDatetimeString(String datetimeString) throws ParseException {
        super.setDatetimeString(datetimeString);
        this.endDatetime = new Date(getDateTime().getTime() + durationInSeconds * 1000);
    }

    public int getDurationInSeconds() {
        return durationInSeconds;
    }

    public void setTimeInSeconds(int durationInSeconds) {
        this.durationInSeconds = durationInSeconds;
    }

    public Date getEndDatetime() {
        return endDatetime;
    }

}
